<template>
    <h1>EL-单选组件</h1>
    <el-radio-group v-model="radio">
      <el-radio label="学历：初中" value="初中"></el-radio>
      <el-radio label="学历：高中" value="高中"></el-radio>
      <el-radio value="专科">学历：专科</el-radio>
      <el-radio label="学历：本科" value="本科"></el-radio>
      <el-radio label="学历：硕士" value="硕士"></el-radio>
      <el-radio label="学历：博士" value="博士"></el-radio>
    </el-radio-group>
    <h4>您的学历是：{{radio}}</h4>
    <hr>
    <el-radio-group v-model="price">
        <el-radio v-for="item in arr" :label="item.title" :value="item.price"></el-radio>
    </el-radio-group>
    <h4>您选择的车价为：{{price}}</h4>
</template>

<script setup>
import {ref} from "vue";

//定义变量用来保存单选提交
let radio = ref('本科')
//定义数组用来保存爱车，模拟从后端查到的数据
const arr = ref([
    {title : '红旗', price : 1800000}
    ,{title : '梅赛德斯奔驰', price : 700000}
    ,{title : '宝马', price : 600000}
    ,{title : '奥迪', price : 500000}
    ,{title : '大众', price : 400000}
    ,{title : '丰田', price : 300000}
    ,{title : '本田', price : 200000}
    ,{title : '马自达', price : 100000}
    ,{title : '别克', price : 90000}
    ,{title : '现代', price : 110000}
]);
//定义变量用来保存价格
//let title = ref('红旗');
let price = ref(1800000);
</script>

<style scoped>

</style>